home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2514 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  74 lines

  1. Path: futures.wharton.upenn.edu!ryan05
  2. From: ryan05@futures.wharton.upenn.edu (Arthur Ryan)
  3. Newsgroups: comp.lang.c++
  4. Subject: Error C2674 & Beginner's Array Assistance
  5. Date: 18 Jan 1996 01:39:38 GMT
  6. Organization: University of Pennsylvania
  7. Message-ID: <4dk8cq$14q@netnews.upenn.edu>
  8. NNTP-Posting-Host: futures.wharton.upenn.edu
  9. X-Newsreader: TIN [version 1.2 PL2-upenn1.1]
  10.  
  11. How do you get around error C2674.  When I run the code below the 
  12. compiler returns the message - 'error C2674: '>>' : no accpetable 
  13. conversions from 'int' to class ::ifstream' Cl returned error code 2' -
  14. The file to read in to the array is a 'CSV' file containing numeric 
  15. values of differing lenghts.  Thanks for your help.  ARyan
  16.  
  17.  
  18. Code below:-
  19.  
  20. #include <iostream.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <fstream.h>
  24. #include <io.h>
  25.  
  26. disp_menu();
  27. data_in();
  28.  
  29. int huge oda[774][29];  //huge array 'oda' 
  30.         
  31. main()
  32. {
  33. menu display and branching etc ...
  34.  
  35. }
  36.  
  37. data_in()
  38. {
  39. int i,j;
  40.  
  41. ifstream fsin;
  42. fsin.open("A:\n&n\test.csv",ios::in);
  43.  
  44. if(fsin.bad())
  45.     {
  46.     cout << "\n*** Serious I/O error ***\n";
  47.     exit(0);
  48.     }
  49.  
  50.  
  51. while (!fsin.eof())
  52.             for (i=0;i<775;i++)
  53.                {
  54.                    for(j=0;j<29;j++)
  55.                 {
  56.                 fsin >> oda [i][j];
  57.                    }
  58.                ;
  59.                }
  60.     
  61. fsin.close();
  62.  
  63. for (i=0;i<775;i++)
  64. {
  65.     for (j=0;j<29;j++)
  66.     {
  67.      cout << oda [i][j];
  68.     }
  69. cout << endl;
  70. }    
  71.  
  72. return(0);
  73. }
  74.